How to Get Zone Information
The Zone Information Protocol (ZIP) obtains the zone information by using
the AppleTalk Transaction Protocol (ATP) to send an information request to a
router. The xppTimeOut field specifies the amount of time, in seconds, that
attempt to obtain the data before returning the reqFailed (request failed)
result code.
The zipBuffPtr field is a pointer to a data buffer that you must allocate. This functions and 33 bytes for the GetMyZone function. ZIP returns the zone names (as a packed array of packed strings) into this buffer. The zipNumZones field returns the actual number of zone names that ZIP placed in the buffer.
You must set the zipLastFlag field to 0 (FALSE) before you execute the
still 0 when the command has completed execution, then ZIP is waiting to
return more zone names. In this case you must empty the buffer (or allocate a
immediately. When there are no more zone names to return, ZIP sets the
zipLastFlag field to a nonzero (TRUE) value.
The zipInfoField field is a 70-byte data buffer that you must allocate for use by The .XPP Driver. The first time you call any of these functions, you must set the first word of this field to 0. You must not change any values in this field
subsequently.
The listing below illustrates the use of the GetZoneList function. The // Assuming inclusion of
#include <AppleTalk.h>
void doGetZoneList (void);
void EmptyDataBuf(XPPParamBlock *myXPPPB);
void YourZIPProc(XPPParamBlock *myXPPPB);
void DoError (OSErr myErr);
void doGetZoneList ()
{
myXPPPB.XCALL.xppTimeout = 3; // timeout period for .XPP
myXPPPB.XCALL. xppRetry = 4; // retry count
myXPPPB.XCALL.zipBuffPtr = NewPtr(578);// zone names returned here myXPPPB.XCALL.zipLastFlag = 0; // set to 0 the first time through
myXPPPB.XCALL. zipInfoField[0] = 0;
myXPPPB.XCALL. zipInfoField[1] = 0; // first word is 0 the first
// time through
myErr = noErr;
// Check the zipNumZones field to determine how many zone names
// have been returned in the buffer. Append the zone names to the
// end of your own buffer before returning to read more zone names.
// loop to get all of the zone names
while ( (!myXPPPB.XCALL.zipLastFlag) && (! myErr) ) {
EmptyDataBuf(&myXPPPB); // your routine to empty
// data buffer
}
YourZIPProc(&myXPPPB); // your routine to process names
if (myErr != noErr)
DoError( myErr);
// there's an error
DisposPtr(myXPPPB.XCALL.zipBuffPtr); // give space back }
value (xCall, which is equal to 246) for the csCode parameter to the XPP
parameter block. The xCall routine uses the value of the xppSubCode parameter
to distinguish between the functions, as follows:.